ELFSER page# 0001 next
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
ELFSER page# 0002 next prev
25: IFN ELFNUM <SUBTTL ELFSER PDP-11 SERVICE
26: BEGIN ELFSER - 15 MAY 74 - BO
27:
28: CBOX←←0
29: SPS41←←0
30: NEWCNI←←0
31:
32: IFNDEF DBG11 <DBG11←←0>
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64: HNGBIT←←1000
65: NOTRY←←100
66: INTREQ←←400000
ELFSER page# 0003 next prev
68:
69:
70:
71:
72: SETADR←←400000
73:
74:
75: IRESET←←100000
76: CLRINT←←40000
77: IGNPAR←←20000
78: STOPIT←←10000
79: DOIT←←4000
80: WRITE←←2000
81: GRAB←←1000
82: SGNEXT←←400
83:
84: ONEWD←←0
85: TWOWD←←100
86: TWOWDR←←200
87: TWOWDL←←300
88:
89: SCHN←←ELFCHN⊗3
90:
91: DCHN←←ELDCHN
92:
93:
94:
95: SPINT←←400000
96:
97:
98:
99:
100:
101: IREQ←←400000
102:
103: ADRERR←←200000
104:
105: NXM11←←100000
106: BUSTO←←40000
107: BINIT←←20000
108: PARBAD←←10000
109:
110: BUSY←←4000
111: DONE←←2000
112:
113:
114:
115: NTRY←←=10
ELFSER page# 0004 next prev
117:
118:
119: HCOR←←100000
120:
121: IFN CBOX < These locations are on the Unibus.
122:
123: DEFINE WADDR(ADR){ADR⊗-1} ;Translate byte to word address
124:
125: CREG←←WADDR(777170) ;Comm register 1
126: IREG←←WADDR(777172) ;Comm register 2 (causes IREQ when written)
127: SREG←←WADDR(777174) ;Switches 15:00 (write), data lights (read)
128: FREG←←WADDR(777176) ;Function register
129:
130: ;FREG bits: 15:14 (w) switch register 17:16
131: ; 12:11 (w) address display mode
132: PPHY←←00000
133: KRND←←04000
134: KRNI←←10000
135: CPHY←←14000
136: SUPD←←20000
137: SUPI←←24000
138: USRD←←30000
139: USRI←←34000
140:
141: ; 5 (w) S-INST/S-CYCLE
142: SINST←←00
143: SCYCL←←40
144:
145: ; 4 (w) HALT/ENABLE
146: ENABL←←00
147: HALT ←←20
148:
149: ; 3:0 (pw) spring-loaded switches
150: LADR ←←01
151: EXAM ←←02
152: DEP ←←03
153: REXAM←←04
154: RDEP ←←05
155: START←←06
156: CONT ←←07
157: INT4 ←←10
158: INT5 ←←11
159: INT6 ←←12
160: INT7 ←←13
161:
162: ; Bit 0 (r) ADRS ERR
163: ADRERR←←1
164:
165: PSWD←←WADDR(777776) ;Program Status word
166: STKLIM←←WADDR(777774) ;Kernel stack limit
167:
168: >
ELFSER page# 0005 next prev
170:
171:
172: IFN SPS41 <
173:
174: MCR0←←WADDR(765000) ;Bit function if 1 (write):
175:
176: EXT←←2 ;IOP external
177: WBE←←4 ;Enable writes into memories
178: PMENB←←10 ;Enable writes into program memories
179: CHNENB←←20 ;Enable channels 1-17
180: ISINT←←40 ;IS internal
181: INIT←←1000 ;Initialize all interfaces, halt the IS
182:
183: EXTERN←←EXT+WBE+PMENB+CHNENB
184: INTERN←←WBE+PMENB+CHNENB+ISINT
185:
186: MCR1←←MCR0 + 1
187:
188: COFF←←1 ;Master clock off (stop)
189: ENAB←←2 ;Enable Unibus access to box memories
190:
191: STOP41←←COFF+ENAB
192:
193: MCR2←←MCR1 + 1
194:
195: ONESTP←←1 ;Single step anything in internal mode
196:
197: MCR3←←MCR2 + 1
198: >
ELFSER page# 0006 next prev
200:
201:
202: JRST ELFINI
203: JRST ELFHNG
204: ↑ELFDSP:
205: JRST ELFREL
206: POPJ P,
207: JRST UUOERR
208: JRST UUOERR
209: JRST CPOPJ1
210: JRST CPOPJ1
211: JRST ELFDOU
212: JRST ELFDIN
213: JRST ELFUSO
214: JRST ELFUSI
215: JRST ELFGTF
216: JRST CPOPJ1
217: POPJ P,
218: POPJ P,
219: JRST ELFMTA
220:
221:
222:
223: DEFINE D(X) {X←L↔L←←L+1}
224: L←←ELFLOC-ELFDDB
225:
226: D INTCNI
227: D USOUT
228: D USIN
229: D UIOWD
ELFSER page# 0007 next prev
231:
232:
233:
234:
235: ELFIN0: MOVEM IOS,DEVIOS(DDB)
236: ELFREL:
237: ELFINI: CONO D11,IRESET+CLRINT
238: MOVE TAC,[XWD DOIT+SCHN,SETADR]
239: MOVEM TAC,USIN(DDB)
240: MOVE TAC,[XWD WRITE+DOIT+SCHN,SETADR]
241: MOVEM TAC,USOUT(DDB)
242: POPJ P,
243:
244:
245: ELFCLS: CONO D11,STOPIT+SCHN
246: CONI D11,TEM
247: TRZ TEM,GRAB
248: MOVEI IOS,200
249: ANDCAB IOS,DEVIOS(DDB)
250: JRST CPOPJ1
251:
252: IFE DBG11 <
253:
254:
255: ↑ELFINT:
256: JSR ELFSAV
257: MOVEI DDB,ELFDDB
258: MOVE DAT,DEVMOD(DDB)
259: TRNE DAT,ASSPRG
260: JRST ELFIN1
261: CONO D11,IRESET+CLRINT
262: POPJ P,
263:
264: ELFIN1: CONI D11,INTCNI(DDB)
265: CONO D11,CLRINT+SCHN
266:
267: IFN CBOX <
268: MOVE DAT,INTCNI(DDB) ;Save the status for the I/O routine.
269: TRNN DAT,IREQ ;Did the 11 request this interrupt?
270: POPJ P, ;No. There must be a transfer in progress.
271: ;The I/O routine will notice that BUSY and
272: ;DONE are clear.
273: MOVSI IOS,DEVSBB
274: ANDCA IOS,DEVIOS(DDB) ;Clear the I/O active indicator,
275: TLO IOS,INTREQ ;set flag saying this interrupt happened.
276: LDB J,PJOBN
277: TLZE IOS,IOW ;Is the job waiting for this interrupt?
278: PUSHJ P,SETIOD ;Yes. Let it continue.
279: MOVEM IOS,DEVIOS(DDB)
280: >
281: POPJ P,
282: >
283:
284:
285:
286: IFN CBOX <
287: ELFHNG: CONO PI,ELFOFF ;Prevent interference from interrupt routine.
288: TLZ IOS,DEVSBB
289: TLZE IOS,IOW ;If the job was waiting for an interrupt,
290: PUSHJ P,SETIOD ;let it run.
291: MOVEM IOS,DEVIOS(DDB)
292: CONO PI,ELFON
293: JRST CPOPJ1
294: >
295: IFE CBOX <ELFHNG: POPJ P,>
ELFSER page# 0008 next prev
297:
298:
299: ELFDOU: TLZE IOS,IOBEG
300: PUSHJ P,ELFINI
301: MOVE TAC,USOUT(DDB)
302: XCTR XR,[MOVE DAT,(UUO)]
303: PUSHJ P,WTB
304: JFCL
305: TLO TEM,SETADR
306: HLRM TEM,USOUT(DDB)
307: JRST SETIOS
308:
309: ELFDIN: TLZE IOS,IOBEG
310: PUSHJ P,ELFINI
311: MOVE TAC,USIN(DDB)
312: XCTR XR,[MOVE DAT,(UUO)]
313: PUSHJ P,RDB
314: JFCL
315: TLO TEM,SETADR
316: HLRM TEM,USIN(DDB)
317: JRST SETIOS
ELFSER page# 0009 next prev
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336: IFE CBOX <MTMIN←←1
337: MTTBL←.-MTMIN>
338: IFN CBOX <MTMIN←←0
339: MTTBL: MTP0>
340: FILL11
341: PEEK11
342: POKE11
343: ELFCLS
344: IFN CBOX < EXAMI
345: DEPOS
346: REXAMI
347: RDEPOS>
348: MTMAX←←.-MTTBL
349:
350: ELFMTA: TLZE IOS,IOBEG
351: PUSHJ P,ELFINI
352: XCTR XR,[MOVE TAC1,(UUO)]
353: LDB TAC,[POINT 9,TAC1,8]
354: IOR TAC1,[XWD SETADR,SETADR]
355: IFN MTMIN <CAIL TAC,MTMIN>
356: CAILE TAC,MTMAX
357: JRST UUOERR
358: PUSHJ P,@MTTBL(TAC)
359: CAIA
360: AOS (P)
361:
362: SETIOS: MOVEM IOS,DEVIOS(DDB)
363: MOVEI IOS,0
364: LDB AC1,[POINT 3,TEM,21]
365: DPB AC1,[POINT 3,IOS,22]
366: TRZ TEM,DONE
367: LDB AC1,[POINT 5,TEM,26]
368: DPB AC1,[POINT 5,IOS,28]
369: TRNE TEM,NXM11+BUSTO+PARBAD+BUSY+ADRERR
370: TRO IOS,IODERR
371: IORB IOS,DEVIOS(DDB)
372: POPJ P,
ELFSER page# 0010 next prev
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384: ELFGTF: TLZE IOS,IOBEG
385: PUSHJ P,ELFIN0
386: MOVE TAC,USIN(DDB)
387: PUSHJ P,GETF
388: MOVE TAC,USOUT(DDB)
389:
390: GETF: LDB TAC1,[POINT 4,TAC,11]
391: TLNE TAC,IGNPAR
392: TRO TAC1,20
393: MOVS TAC1,TAC1
394: TLO TAC1,400000
395: HRR TAC1,TAC
396: XCTR XW,[MOVEM TAC1,(UUO)]
397: AOS UUO
398: POPJ P,
399:
400:
401:
402:
403:
404:
405:
406:
407:
408:
409:
410:
411:
412:
413: ELFUSI: TLZE IOS,IOBEG
414: PUSHJ P,ELFIN0
415: MOVE TAC,USIN(DDB)
416: PUSHJ P,USET
417: MOVEM TAC,USIN(DDB)
418: POPJ P,
419:
420: ELFUSO: TLZE IOS,IOBEG
421: PUSHJ P,ELFIN0
422: MOVE TAC,USOUT(DDB)
423: PUSHJ P,USET
424: MOVEM TAC,USOUT(DDB)
425: POPJ P,
ELFSER page# 0011 next prev
427:
428:
429:
430:
431:
432:
433:
434:
435:
436:
437:
438: IFN CBOX <
439: MTP0: TLZE IOS,INTREQ ;Has it interrupted?
440: JRST INTIN ;Yes. Do the peek.
441: MOVEI TEM,0 ;No. Clear error return bits in case...
442: TRCN TAC1,77 ;Does he want to wait?
443: POPJ P, ;No wait. Just return.
444: TRCN TAC1,77 ;He does. Did he specify infinite time?
445: TRZ TAC1,77 ;Yes. Clear the hung timer.
446: DPB TAC1,PDVCNT ;No. Set the hung timer.
447: CONO PI,ELFOFF ;Avoid interference...
448: MOVE IOS,DEVIOS(DDB) ;make sure the interrupt hasn't happened.
449: TLZE IOS,INTREQ
450: JRST INTIN0
451: MOVSI IOS,DEVSBB ;OK, we're sure now.
452: IORM IOS,DEVIOS(DDB) ;Set the I/O busy indicator,
453: CONO PI,ELFON
454: PUSHJ P,WSYNC ;wait until something happens.
455:
456: MOVEI TEM,0 ;We wake up. Clear the error indications.
457: MOVE IOS,DEVIOS(DDB)
458: TLZE IOS,INTREQ ;Did the desired interrupt happen?
459: JRST INTIN
460: TRO IOS,HNGBIT ;No. The hung time ran out.
461: POPJ P,
462:
463: INTIN0: CONO PI,ELFON
464: INTIN: HRRI TAC1,SETADR+CREG;Set up a PEEK CREG.
465: TLNN TAC1,TWOWDL
466: TLO TAC1,TWOWD ;Fall into the PEEK routine.
467: >
468:
469:
470:
471: PEEK11: MOVSI TAC,DOIT+SCHN
472: PUSHJ P,SETCON
473: PUSHJ P,RDW
474: POPJ P,
475: XCTR XW,[MOVEM DAT, 1(UUO)]
476: JRST CPOPJ1
ELFSER page# 0012 next prev
478:
479:
480:
481:
482: FILL11: TLZ TAC1,3
483: MOVSI TAC,WRITE+DOIT+SCHN
484: PUSHJ P,SETCON
485: XCTR XR,[MOVE DAT,1(UUO)]
486: MOVE AC2,[XWD -NTRY,FILLR]
487: FILL0: HLRZ TAC1,DAT
488: JUMPE TAC1,CPOPJ1
489: FILL1: PUSHJ P,DOCON
490: FILL2: CONSO D11,DONE
491: JSP AC1,WDONE
492: DATAO D11,DAT
493: SOJG TAC1,FILL2
494: JRST WTBE
495:
496: FILLR: AOJ TAC1,
497: MOVS TAC1,TAC1
498: HRR TAC1,DAT
499: CAMN DAT,TAC1
500: JRST FILL0
501: SUB TAC1,DAT
502: ADD DAT,TAC1
503: MOVN TAC1,TAC1
504: MOVS TAC1,TAC1
505: ADD TAC1,TAC
506: TRO TAC1,SETADR
507: HRR TAC,TAC1
508: JRST FILL0
ELFSER page# 0013 next prev
510:
511:
512: IFN CBOX <
513:
514: EXAMI: PUSHJ P,LDADR
515: POPJ P,
516: MOVEI DAT,HALT+CPHY+EXAM
517: RDIT: PUSHJ P,WTW
518: POPJ P,
519: PUSHJ P,RDLGTS
520: POPJ P,
521: XCTR XW,[HLREM DAT,1(UUO)]
522: JRST CPOPJ1
523:
524: REXAMI: PUSHJ P,LRADR
525: POPJ P,
526: MOVEI DAT,HALT+REXAM
527: JRST RDIT
528:
529: DEPOS: PUSHJ P,LDADR
530: POPJ P,
531: MOVEI DAT,HALT+CPHY+DEP
532: WRTIT: XCTR XR,[HRL DAT,1(UUO)]
533: PUSHJ P,WTW
534: POPJ P,
535:
536: RDLGTS: MOVE TAC,[XWD DOIT+SCHN,SETADR+SWREG]
537: TRZ TAC1,SETADR
538: PUSHJ P,SETCON
539: PUSHJ P,RDW
540: POPJ P,
541: TRNN DAT,1
542: JRST CPOPJ1
543: TRO TEM,ADRERR
544: POPJ P,
545:
546: RDEPOS: PUSHJ P,LRADR
547: POPJ P,
548: MOVEI DAT,HALT+RDEP
549: JRST WRTIT
550:
551: LRADR: MOVEI DAT,CPHY+HALT+LADR
552: DPB TAC1,[POINT 4,DAT,17]
553: JRST ADRLOD
554:
555: LDADR: MOVEI DAT,CPHY+HALT+LADR
556: DPB TAC1,[POINT 15,DAT,16]
557: LDB TAC,[POINT 2,TAC1,20]
558: DPB TAC,[POINT 2,DAT,16]
559: ADRLOD: MOVE TAC,[XWD WRITE+TWOWD+DOIT+SCHN,SETADR+SWREG]
560: TLNE TAC1,20
561: TLO TAC,GRAB
562: JRST WTW
563:
564: PSTART: MOVEI DAT,HALT+START
565: MOVE TAC,[XWD WRITE+DOIT+SCHN,SETADR+FREG]
566: PUSHJ P,WTW
567: POPJ P,
568: PUSHJ P,LDADR
569: POPJ P,
570: MOVE TAC,[XWD WRITE+DOIT+SCHN,SETADR+FREG]
571: MOVEI DAT,START
572: PUSHJ P,WTW
573: POPJ P,
574: JRST RDLGTS
575:
576: >
ELFSER page# 0014 next prev
578:
579:
580:
581:
582:
583: RDB: MOVE AC2,[XWD -NTRY,RDBR]
584: ADD DAT,[1,,0]
585: PUSHJ P,RELIOW
586: JUMPGE DAT,RDBONE
587: RDB1: PUSHJ P,DOCON
588: RDB2: CONSO D11,DONE
589: JSP AC1,WDONE
590: BLKI D11,DAT
591: JRST RDBE
592: JRST RDB2
593:
594: RDBR: PUSHJ P,UPDADR
595: JRST RDB1
596:
597: RDBER: PUSHJ P,UPDADR
598: RDBONE: PUSHJ P,DOCON
599: RDBE: HRRI AC2,RDBER
600: JSP AC1,WDONE
601: CONI D11,TEM
602: CONO D11,SETADR
603: DATAI D11,1(DAT)
604: JRST CPOPJ1
605:
606:
607:
608:
609:
610:
611:
612:
613:
614:
615: RDW: MOVE AC2,[XWD -NTRY,.+1]
616: PUSHJ P,DOCON
617: JSP AC1,WDONE
618: CONI D11,TEM
619: CONO D11,SETADR
620: DATAI D11,DAT
621: JRST CPOPJ1
ELFSER page# 0015 next prev
623:
624:
625:
626:
627: WTB: MOVE AC2,[XWD -NTRY,WTBR]
628: PUSHJ P,RELIOW
629: WTB1: PUSHJ P,DOCON
630: WTB2: CONSO D11,DONE
631: JSP AC1,WDONE
632: BLKO D11,DAT
633: JRST WTBE
634: JRST WTB2
635:
636: WTBR: SUB DAT,[1,,1]
637: PUSHJ P,UPDADR
638: JRST WTB1
639:
640:
641:
642: POKE11: MOVSI TAC,WRITE+DOIT+SCHN
643: PUSHJ P,SETCON
644: XCTR XR,[MOVE DAT,1(UUO)]
645:
646:
647:
648:
649: WTW: MOVE AC2,[XWD -NTRY,.+1]
650: PUSHJ P,DOCON
651: JSP AC1,WDONE
652: DATAO D11,DAT
653: WTBE: JSP AC1,WDONE
654: CONI D11,TEM
655: JRST CPOPJ1
ELFSER page# 0016 next prev
657:
658:
659:
660:
661:
662:
663: UPDADR: SUB DAT,TAC1
664: JUMPE DAT,UPDAD2
665: HRLI AC2,-NTRY
666: ADDM DAT,UIOWD(DDB)
667: HRRZ AC3,DAT
668: TLNE TAC,TWOWDL
669: LSH AC3,1
670: ADD TAC,AC3
671: UPDAD2: ADD DAT,TAC1
672: TLNN TEM,NXM11
673: POPJ P,
674: SKIPA DAT,UIOWD(DDB)
675:
676:
677:
678: RELIOW: MOVEM DAT,UIOWD(DDB)
679: MOVEI TAC1,1(DAT)
680: PUSHJ P,RELOCA
681: JRST UADRER
682: TLNN TAC,WRITE
683: JUMPL TAC1,UADRER
684: HRRI DAT,-1(TAC1)
685: HLRE TAC1,DAT
686: MOVM TAC1,TAC1
687: ADD TAC1,UIOWD(DDB)
688: TLNN TAC,WRITE
689: ADDI TAC1,1
690: PUSHJ P,RELOCB
691: JRST UADRER
692: MOVE TAC1,DAT
693: POPJ P,
ELFSER page# 0017 next prev
695:
696:
697:
698:
699: WDONE: CONSZ D11,DONE
700: JRST (AC1)
701: MOVEI AC3,=10
702: WDONE1: CONI D11,TEM
703: TRNN TEM,BUSY
704: JRST WDONE2
705: SOJG AC3,WDONE1
706: CONO D11,IRESET+CLRINT+STOPIT
707: JRST WDONE4
708:
709: WDONE2: TRNE TEM,DONE
710: JRST (AC1)
711: IFE DBG11 <MOVE TEM,INTCNI(DDB)>
712: IFN CBOX < TRNE TEM,IREQ ;If it was requested by the 11,
713: JRST (AC2)>
714: TRNE TEM,BUSTO
715: JRST WDONE5
716: IFN NEWCNI < TRNE TEM,NXM11
717: TRNN TEM,BINIT
718: CAIA>
719: IFE NEWCNI < TRNE TEM,NXM11>
720: TRNE IOS,NOTRY
721: WDONE3: POPJ P,
722: SOJ AC2,
723: AOBJP AC2,WDONE3
724: JRST DLAY
725:
726: WDONE4: TRNE IOS,NOTRY
727: POPJ P,
728: WDONE5: SOJ AC2,
729: AOBJN AC2,1(AC2)
730: POPJ P,
731:
732:
733:
734: DOCON: CONO D11,(TAC)
735: HLR AC1,TAC
736: IFN DBG11 <TRZ AC1,77>
737: CONO D11,(AC1)
738: POPJ P,
ELFSER page# 0018 next prev
740:
741:
742:
743:
744: USET: XCTR XR,[MOVE TAC1,(UUO)]
745:
746:
747:
748:
749: SETCON: JUMPGE TAC1,SETC1
750: HLRZ AC1,TAC1
751: DPB AC1,[POINT 4,TAC,11]
752: TRNE AC1,20
753: TLO TAC,IGNPAR
754: SETC1: TRNE TAC1,400000
755: HRR TAC,TAC1
756: POPJ P,
757:
758:
759:
760: DLAY:
761: IFN DBG11 <
762: MOVEI AC3,0
763: SLEEP AC3,
764: >
765: IFE DBG11 <
766: PUSH P,TAC
767: PUSH P,TAC1
768: PUSH P,AC2
769: PUSH P,TEM
770: MOVEI TAC,1
771: PUSHJ P,SLEEPT
772: POP P,TEM
773: POP P,AC2
774: POP P,TAC1
775: POP P,TAC
776: >
777: JRST (AC2)
778:
779: BEND ELFSER
780: >
EOF: ELFSER end-of-file. cnt=17